//***********************************************************************
//	File:		Player.h
//	Author:		
//	Course:		SGP 1405
//	Purpose:	
//***********************************************************************
//***********************************************************************
//	Purposfully left blank for all comments regarding this file 
//	
//	
//	
//***********************************************************************




#pragma once


#include "Moveable.h"

#include "../SGD Wrappers/SGD_Handle.h"
#include "../SGD Wrappers/SGD_Declarations.h"

#include "../SGD Wrappers/SGD_Listener.h"

#include <string>

class Player :
	public Moveable, 
	public SGD::Listener
{
public:
	enum ProjectileType{MACHINE_GUN, FLAME_THROWER, HEAT_SEEKER};

	//Trilogy
	Player(float posX = -1, float posY = -1, bool sniper = true);
	~Player();
	Player(const Player&) = default; 
	Player& operator =(const Player&) = default; 

	//Type
	int GetType() const { return ENT_PLAYER; }

	void Update(float dt);
	void Render();
	void HandleCollision(const IEntity* pOther);
	void HandleEvent( const SGD::Event* pEvent) override;
	SGD::Rectangle GetRect() const;
	void ModifyHealth(float hpAmount);
	void ApplyFriction(float dt);

	//Player specific
	void ModifyScore(int value); 

	//Accessors for Ground Player
	int				GetCurrWeapon				(void)					{ return m_nCurrWeapon; }
	char			GetAltWepType				(void)					{ return m_chAltWepType; }
	std::string		GetInitials					(void)					{ return m_sInitials; }
	bool			GetIsProne					(void)					{ return m_bIsProne; }
	bool			GetIsDashing				(void)					{ return m_bIsDashing; }
	float			GetReloadCDL				(void)					{ return m_fReloadCDL; }
	float			GetReloadTimer				(void)					{ return m_fReloadTimer; }
	float			GetDashingCDL				(void)					{ return m_fDashingCDL; }
	float			GetDashingTimer				(void)					{ return m_fDashingTimer; }
	float			GetDashingCost				(void)					{ return m_fDashingCost; }
	float			GetCurrAmmo					(void)					{ return m_fCurrAmmo; }
	float			GetMaxAmmo					(void)					{ return m_fMaxAmmo; }
	float			GetAttackRateGround			(void)					{ return m_fAttackRateGround; }
	float			GetAttackTimer				(void)					{ return m_fAttackTimer; }
	float			GetSprintCost				(void)					{ return m_fSprintCost; }
	float			GetSprintSpeed				(void)					{ return m_fSprintSpeed; }
	SGD::HAudio		GetTakeDamageSfx			(void)					{ return m_hTakeDamageSfx; }
	SGD::HTexture	GetProneImg					(void)					{ return m_hProneImg; }

	//Air player Accessors
	bool			GetHoldBreath				(void)					{ return m_bHoldBreath; }
	float			GetConcussionCDL			(void)					{ return m_fConcussionCDL; }
	float			GetConfuseCDL				(void)					{ return m_fConfuseCDL; }
	float			GetCryoNetCDL				(void)					{ return m_fCryoNetCDL; }
	float			GetGrenadeCDL				(void)					{ return m_fGrenadeCDL; }
	float			GetConcussionTimer			(void)					{ return m_fConcussionTimer; }
	float			GetConfuseTimer				(void)					{ return m_fConfuseTimer; }
	float			GetGrenadeTimer				(void)					{ return m_fGrenadeTimer; }
	float			GetCryoNetTimer				(void)					{ return m_fCryoNetTimer; }
	float			GetHealthRegenRate			(void)					{ return m_fHealthRegenRate; }
	float			GetBreathCost				(void)					{ return m_fBreathCost; }
	float			GetAttackRateAir			(void)					{ return m_fAttackRateAir; }
	float			GetReticleVelocity			(void)					{ return m_fReticleVelocity; }
	float			GetReticleBreathVelocity	(void)					{ return m_fReticleBreathVelocity; }
	float			GetKnockbackTimer			(void)					{ return m_fKnockbackTimer; }
	float			GetKnockbackCDL				(void)					{ return m_fKnockbackCDL; }
	SGD::HTexture	GetCrosshairImg				(void)					{ return m_hCrosshairImg; }

	//Accessors for both players
	bool			GetIsSniper					(void)					{ return m_bIsSniper; }
	float			GetStamina					(void)					{ return m_fStamina; }
	float			GetStaminaRegenRate			(void)					{ return m_fStaminaRegenRate; }
	float			GetMaxStamina				(void)					{ return m_fMaxStamina; }
	int				GetLives					(void)					{ return m_nLives; }
	int				GetScore					(void)					{ return m_nScore; }

	//Mutators for ground player
	void SetCurrWeapon							(int cw)				{ m_nCurrWeapon = cw; }
	void SetAltWepType							(char awt)				{ m_chAltWepType = awt; }
	void SetInitials							(std::string i)			{ m_sInitials = i; }
	void SetIsProne								(bool ip)				{ m_bIsProne = ip; }
	void SetIsDashing							(bool id)				{ m_bIsDashing = id; }
	void SetReloadCDL							(float rCDL)			{ m_fReloadCDL = rCDL;  }
	void SetReloadTimer							(float rt)				{ m_fReloadTimer = rt; }
	void SetDashingCDL							(float dCDL)			{ m_fDashingCDL = dCDL; }
	void SetDashingTimer						(float dashtim)			{ m_fDashingTimer = dashtim; }
	void SetDashingCost							(float dc)				{ m_fDashingCost = dc; }
	void SetCurrAmmo							(float ca)				{ m_fCurrAmmo = ca; }
	void SetMaxAmmo								(float ma)				{ m_fMaxAmmo = ma; }
	void SetAttackRateGround					(float arg)				{ m_fAttackRateGround = arg; }
	void SetAttackTimer							(float at)				{ m_fAttackTimer = at; }
	void SetSprintCost							(float sc)				{ m_fSprintCost = sc; }
	void SetSprintSpeed							(float ss)				{ m_fSprintSpeed = ss; }
	void SetTakeDamageSfx						(SGD::HAudio tdsfx)		{ m_hTakeDamageSfx = tdsfx; }
	void SetProneImg							(SGD::HTexture pimg)	{ m_hProneImg = pimg; }

	//Air Player Mutators
	void	SetHoldBreath						(bool hb)				{ m_bHoldBreath = hb; }
	void	SetConcussionCDL					(float concCDL)			{ m_fConcussionCDL = concCDL; }
	void	SetConfuseCDL						(float confCDL)			{ m_fConfuseCDL = confCDL; }
	void	SetCryoNetCDL						(float cryoCDL)			{ m_fCryoNetCDL = cryoCDL; }
	void	SetGrenadeCDL						(float gCDL)			{ m_fGrenadeCDL = gCDL; }
	void	SetConcussionTimer					(float conct)			{ m_fConcussionTimer = conct; }
	void	SetConfuseTimer						(float conft)			{ m_fConfuseTimer = conft; }
	void	SetGrenadeTimer						(float gt)				{ m_fGrenadeTimer = gt; }
	void	SetCryoNetTimer						(float ct)				{ m_fCryoNetTimer = ct; }
	void	SetHealthRegenRate					(float hrr)				{ m_fHealthRegenRate = hrr; }
	void	SetBreathCost						(float bc)				{ m_fBreathCost = bc; }
	void	SetAttackRateAir					(float arr)				{ m_fAttackRateAir = arr; }
	void	SetReticleVelocity					(float rv)				{ m_fReticleVelocity = rv; }
	void	SetReticleBreathVelocity			(float rbv)				{ m_fReticleBreathVelocity = rbv; }
	void	SetKnockbackTimer					(float kbt)				{ m_fKnockbackTimer = kbt; }
	void	SetKnockbackCDL						(float kCDL)			{ m_fKnockbackCDL = kCDL; }
	void	SetCrossHairImg						(SGD::HTexture chimg)	{ m_hCrosshairImg = chimg; }

	//Mutators for both players
	void	SetIsSniper							(bool is)				{ m_bIsSniper = is; }
	void	SetStamina							(float stam)			{ m_fStamina = stam; }
	void	SetStaminaRegenRate					(float srr)				{ m_fStaminaRegenRate = srr; }
	void	SetMaxStamina						(float ms)				{ m_fMaxStamina = ms; }
	void	SetLives							(int l)					{ m_nLives = l; }
	void	SetScore							(int s)					{ m_nScore = s; }
	
	void	AddScore							(int s)					{ m_nScore += s;}

private:
	// To be called from
	//their generic public counterparts
	void AirUpdate(float dt); 
	void GroundUpdate(float dt); 
	void AirRender(void); 
	void GroundRender(void); 

	//Ground player data members
	int					m_nCurrWeapon = -1; 
	char				m_chAltWepType = -1; 
	std::string			m_sInitials; 
	bool				m_bIsProne = false; 
	bool				m_bIsDashing = false;
	float				m_fReloadCDL = 0.0f; 
	float				m_fReloadTimer = 0.0f; 
	float				m_fDashingCDL = 0.0f; 
	float				m_fDashingTimer = 0.0f;
	float				m_fDashingCost = 0.0f; 
	float				m_fCurrAmmo = 0.0f;
	float				m_fMaxAmmo = 0.0f; 
	float				m_fAttackRateGround = 0.0f; 
	float				m_fAttackTimer = 0.0f; 
	float				m_fSprintCost = 0.0f; 
	float				m_fSprintSpeed = 0.0f; 
	SGD::HAudio			m_hTakeDamageSfx = SGD::INVALID_HANDLE;
	SGD::HTexture		m_hProneImg = SGD::INVALID_HANDLE; 
	SGD::Vector			m_vGetRightStick = {0,0};



	//Air player data members
	bool				m_bHoldBreath = false; 
	float				m_fConcussionCDL = 0.0f;
	float				m_fConfuseCDL = 0.0f; 
	float				m_fCryoNetCDL = 0.0f; 
	float				m_fGrenadeCDL = 0.0f;
	float				m_fConcussionTimer = 0.0f; 
	float				m_fConfuseTimer = 0.0f; 
	float				m_fGrenadeTimer = 0.0f; 
	float				m_fCryoNetTimer = 0.0f; 
	float				m_fHealthRegenRate = 0.0f; 
	float				m_fBreathCost = 0.0f; 
	float				m_fAttackRateAir = 0.0f; 
	float				m_fReticleVelocity = 0.0f; 
	float				m_fReticleBreathVelocity = 0.0f; 
	float				m_fKnockbackTimer = 0.0f; 
	float				m_fKnockbackCDL = 0.0f; 
	SGD::HTexture		m_hCrosshairImg; 


	// both players
	bool				m_bIsSniper = true;
	float				m_fStamina = 0.0f; 
	float				m_fStaminaRegenRate = 0.0f; 
	float				m_fMaxStamina = 0.0f; 
	int					m_nLives = -1; 
	int					m_nScore = -1; 
	
	


};

